import Vue from "vue";
import VueRouter from "vue-router";
import layout from "@/views/layout/index.vue";
import pc from "@/views/pc/index.vue";
import pcHome from "@/views/pc/home/index.vue";
import pcGame from "@/views/pc/game/index.vue";
import pcRecord from "@/views/pc/record/index.vue";
import yi from "@/views/yi/index.vue";
import yiLayout from "@/views/yi/layout/index.vue";
import yiHome from "@/views/yi/home/index.vue";
import yiRecord from "@/views/yi/record/index.vue";
import yiSetting from "@/views/yi/setting/index.vue";
import yiGame from "@/views/yi/game/index.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "layout",
    component: layout,
  },
  {
    path: "/pc",
    name: "pc",
    component: pc,
    redirect: "/pc/home",
    children: [
      {
        path: "home",
        name: "pcHome",
        component: pcHome,
      },
      {
        path: "game",
        name: "pcGame",
        component: pcGame,
      },
      {
        path: "record",
        name: "pcRecord",
        component: pcRecord,
      },
    ],
  },
  {
    path: "/yi",
    component: yi,
    redirect: "/yi/home",
    children: [
      {
        path: "/yi",
        name: "yiLayout",
        component: yiLayout,
        redirect: "/yi/home",
        children: [
          {
            path: "home",
            name: "yiHome",
            component: yiHome,
          },
          {
            path: "record",
            name: "yiRecord",
            component: yiRecord,
          },
          {
            path: "setting",
            name: "yiSetting",
            component: yiSetting,
          },
        ],
      },
      {
        path: "game",
        name: "yiGame",
        component: yiGame,
      },
    ],
  },
];

const router = new VueRouter({
  mode: "hash",
  base: process.env.BASE_URL,
  routes,
});

export default router;
